// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   register_procedure_transfer_ok.java

package manufacture.procedure;

import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;
import validata.ValidataNumber;

public class register_procedure_transfer_ok extends HttpServlet
{

	public register_procedure_transfer_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		javax.servlet.ServletContext dbApplication = dbSession.getServletContext();
		HttpSession session = request.getSession();
		nseer_db_backup1 manufacture_db = new nseer_db_backup1(dbApplication);
		ValidataNumber validata = new ValidataNumber();
		try
		{
			if (manufacture_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String manufacture_ID = request.getParameter("manufacture_ID");
				String procedure_name = request.getParameter("procedure_name");
				String real_amount = request.getParameter("real_amount");
				String details_number = request.getParameter("details_number");
				if (validata.validata(real_amount) && Double.parseDouble(real_amount) > 0.0D)
				{
					String sql3 = (new StringBuilder("update manufacture_procedure set procedure_transfer_tag='3',real_amount='")).append(real_amount).append("' where manufacture_ID='").append(manufacture_ID).append("' and procedure_name='").append(procedure_name).append("' and details_number='").append(details_number).append("'").toString();
					manufacture_db.executeUpdate(sql3);
					String sql4 = (new StringBuilder("update manufacture_manufacture set manufacture_procedure_check_tag='1' where manufacture_ID='")).append(manufacture_ID).append("'").toString();
					manufacture_db.executeUpdate(sql4);
					response.sendRedirect((new StringBuilder("manufacture/procedure/register_procedure_transfer_ok_a.jsp?manufacture_ID=")).append(manufacture_ID).toString());
				} else
				{
					response.sendRedirect((new StringBuilder("manufacture/procedure/register_procedure_transfer_ok_b.jsp?manufacture_ID=")).append(manufacture_ID).append("&&procedure_name=").append(procedure_name).toString());
				}
				manufacture_db.commit();
				manufacture_db.close();
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
